<template>
<view class="">
	<scroll-view scroll-y="true" >
		<view class="welfare-background">
			<welfare-card :info="info"></welfare-card>
			<welfare-task></welfare-task>
			<welfare-everyday-task></welfare-everyday-task>
		</view>
	</scroll-view>
</view>
</template>

<script>
	export default {
	  data() {
	    return {
	      info: '',
	    };
	  },
	  onLoad() {
	    this.getInfo();
	  },
	  methods: {
	    /**
	     * 获取用户信息
	     */
	    getInfo() {
	      //1.获取token
	      const token = uni.getStorageSync('token');
	      if (!token) {
	        //token不存在，表示没有登录
	        uni.navigateTo({
	          url: '/pages/login/login',
	        });
	      }
	
	      uni.request({
	        url: "http://127.0.0.1:8001/app/user/info/person",
	        method: "GET",
	        header: {
	          Authorization: token,
	        },
	        success: ({ data }) => {
	          console.log('=== 用户信息获取成功', data);
	          this.info = data;
	          console.log('info', this.info);
	        },
	      });
	    },
	  },
	};
</script>

<style>
	.welfare-background{
		height: 100vh;
		width: 100%;
		background: url('');
		background-size: contain;
	}
</style>